let admodel = require('../services/admodel')
module.exports = {
    renIndex: async ctx => {
        await ctx.render('admin.html')
    },
    renlogin: async ctx => {
        await ctx.render('adminlogin.html')
    },
    renadd: async ctx => {
        await ctx.render('adminadd.html')
    },
    checkuser: ctx => {
        let username = ctx.request.body.username;
        let pwd = ctx.request.body.pwd
        let res = admodel.checkname(username, pwd)
        let info
        if (res) {
            info = {
                status: 1,
                message: '登录成功'
            }
        } else {
            info = {
                status: 0,
                message: '登录失败'
            }
        }
        ctx.body = info


    }
}